	<style>
<!--

#daydetails{
width: 500px; float: right;
}
-->
</style>


	<script type="text/javascript">
	// increase the default animation speed to exaggerate the effect
	$.fx.speeds._default = 1000;
	$(function() {
		$('#dialog').dialog({
			autoOpen: false,
			show: 'explode',
			hide: 'explode',
			modal: true
		});		
	});
	
				// Dialog Link
			function openThePForm(){
					$('#dialog').dialog('open');
					$.post("<?php echo site_url()?>/patient/new_patient_min",
				   function(data){
					$('.p1').html(data);
				   });
					return false;
				};


	
	$(function() {
		$("#datepicker").datetimepicker({ampm:true});
		$("#datepicker").change(function(){
            datearray=$('#datepicker').val().split('/');
           // alert(datearray[0])
        $('#daydetails').html('<center><br><br><br><img src=<?php echo base_url ()?>images/loading.gif></center>');
		$.post("<?php echo site_url()?>/schedule/show_day_details/"+datearray[1]+'/'+datearray[0]+'/'+datearray[2]+'/1',
               function(data){

                  $('#daydetails').html(data);
            
		           }

				)


			});   

		 

        
		var today = new Date();
    	$('#daydetails').html('<center><br><br><br><img src=<?php echo base_url ()?>images/loading.gif></center>');
		$.post("<?php echo site_url()?>/schedule/show_day_details/"+today.getDate()+'/'+(today.getMonth()+1)+'/'+today.getFullYear()+'/1',
	               function(data){$('#daydetails').html(data);}	)
	         

		  
		
	});
	
	$(function() {
		$("#patient_name").autocomplete({
			source: "<?php echo site_url()?>?c=search&m=patient",
			select: function(event, ui) {
				$("#searched_id").val(ui.item.id);
			}
		});
	});
	</script>
	
	<div id="dialog" title="New">
		<p class="p1"></p>
	</div>

<div id="daydetails"></div>
	<span onClick="openThePForm()" id="dialog_link" class='btn-larg'><?php echo lang('menuitem_add_new').' '.lang('menuitem_patient')?></span>

	<?php echo validation_errors(); ?>
	<form id="customForm" method="post" action="<?php echo site_url()?>/schedule/new_apointment2">

		<input type="hidden" id="apointmentid" name="apointment_form[id]" value="<?php if(isset($id)) echo $id?>" />
		<input type="hidden" id="added_by" name="apointment_form[added_by]" value="<?php if(isset($added_by)) echo $added_by?>" />
		
		<label><?php echo lang('form_label_date')?></label>
		<input id="datepicker" name="apointment_form[date]" type="text" value="<?php if(isset($date)) echo $date?>" />

       
		<label><?php echo lang('menuitem_patient')?></label>
		<input type="text" id="patient_name" name="" value="<?php echo set_value('patient_name'); if(isset($patient_name)) echo $patient_name?>" />
                <input type="hidden" id="searched_id" name="apointment_form[patient_id]"  <?echo set_value('patient_id');?> value="<? if(isset($patient_id)) echo $patient_id ?>"/>
		<label><?php echo lang('general_soctor')?></label>
		<select id="user_id" name="apointment_form[user_id]">
			<option value='a'> <?php echo "-- ".lang('menuitem_select')." --"?></option>
		<?php
			foreach($user as $id => $value){
				if($id == @$user_id)
					echo "<option selected='selected' value='".$id."' ". set_select('apointment_form[user_id]', $id) ." >".$value."</option>";
				else
					echo "<option value='".$id."' ". set_select('apointment_form[user_id]', $id) ." >".$value."</option>";
			}
		?>
		</select>
		<label><?php echo lang('form_label_note')?></label>
		<textarea name="apointment_form[note]" id="note"><?php echo set_value('note'); if(isset($note)) echo $note?></textarea>
		
		
		<input type="submit" id="submit" name="submit" value="<?php echo lang('form_label_save')?>" />
		
		
		
	</form>
	



  
  
  
  
